import React, {Component} from 'react';
import ShowList from '../../../../components/ShowList'
import './index.less'
import {getBrandGoods} from "../../../../network/goods";

class Show extends Component {
    state = {
        apple:[],
        huawei:[],
        mi:[]
    }
    render() {
        return (
            <div className='show'>
                <div className="container">
                    <ShowList arr={this.state.apple}/>
                    <ShowList arr={this.state.huawei}/>
                    <ShowList arr={this.state.mi}/>
                </div>
            </div>
        );
    }
    async componentDidMount() {
        //获取三个品牌的四个商品信息用作展示
        let result = await Promise.all([getBrandGoods(1,4),getBrandGoods(2,4),getBrandGoods(3,4),])
        if(result.length !== 0){
            let apple = result[0].data;
            let huawei = result[1].data;
            let mi = result[2].data;
            this.setState({
                apple,
                huawei,
                mi
            })
        }
    }
}

export default Show;